home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlib43 / mntlib / purec / makefile < prev    next >
Encoding:
Makefile  |  1993-11-02  |  17.3 KB  |  618 lines

  1. ### Makefile for MiNT Library for Pure C and Turbo C
  2. ### hohmuth 19 Feb 1993
  3. ###
  4. ### This makefile needs GNU make.
  5. ###
  6. ### This makefile is pretty tough.. Make sure your make has a large stack!
  7. ### (The MiNT library's standard stack size (8K) is _not_ enough!)
  8.  
  9. ###
  10. ### begin of configuration section
  11. ###
  12.  
  13. # TURBOC= yes if you still use Turbo C.
  14. # If you do so, I strongly suggest upgrading to Pure C.
  15. # Comment this out if you use Pure C.
  16.  
  17. #TURBOC=        yes
  18.  
  19. # COMPILERDIR= the main directory of your Turbo/Pure C installation
  20. # As file names in rules may not contain colons (`:'), this path
  21. # name should _not_ contain a TOS-style drive specification (like "c:").
  22. # If you define TOSIFY_COMMANDS below, this path will be automatically 
  23. # tosified.
  24.  
  25. #COMPILERDIR=    /dev/g/turboc
  26. COMPILERDIR=    /dev/d/pc
  27.  
  28. # BINDIR= where your compiler's tools (pcc.ttp, plink.ttp etc.) reside
  29.  
  30. #BINDIR=        $(COMPILERDIR)
  31. BINDIR=        $(COMPILERDIR)/bin
  32.  
  33. # LIBDIR= where to search for the compiler's libraries. Some of them are
  34. # linked into the MiNT library.
  35.  
  36. LIBDIR=        $(COMPILERDIR)/lib
  37.  
  38. # COMPILERINCDIR= where to find your compiler's includes, especially
  39. # float.h and math.h.
  40. # This is only needed during "make install-includes".
  41.  
  42. COMPILERINCDIR=    $(COMPILERDIR)/include
  43.  
  44. # INCLUDEDIR= where your MiNT library's include files (mntinc) reside.
  45. # If you define TOSIFY_NAMES below, this is path will be automatically 
  46. # tosified for the compiler's -I switch.
  47.  
  48. INCLUDEDIR=    /dev/z/src/lib/include
  49.  
  50. # OSBINDLIB= the location of the osbind library by Ole Arndt und 
  51. # Ulf Moeller, if you have it.  This library replaces our TOS bindings.
  52. # If you use Turbo C, and don't have `awk', you _should_ get this library.
  53. # If you don't have it, you need to have `awk'.  (we need to hack our
  54. # TOS bindings) 
  55. # For Pure C users: You don't need to have this library.
  56. # Comment this out, if you don't have the osbind library.
  57.  
  58. #OSBINDLIB=    $(LIBDIR)/osbind.lib
  59.  
  60. # INSTALLDIR= the directory you want to have the MiNT library installed to.
  61. # This is only needed during "make install".
  62.  
  63. INSTALLDIR=    $(LIBDIR)
  64.  
  65. # COMMONDIR= where the main bulk of the library source resides
  66.  
  67. COMMONDIR=    ..
  68.  
  69. # ASSERTIONS= yes if you want to activate the library's calls to assert().
  70. # Comment this out if you don't.
  71.  
  72. #ASSERTIONS=    yes
  73.  
  74. # DEBUGINFO= yes, if you want your libraries created with debug info.
  75. # Comment this out if you don't.
  76.  
  77. #DEBUGINFO=    yes
  78.  
  79. # PCREL= yes, if you want all sub-routine calls to be PC relative.
  80. # This can cause problems with bigger projects, however.
  81. # Comment this out if you prefer absolute calls to sub-routines.
  82.  
  83. #PCREL= yes
  84.  
  85. # TOSIFY_NAMES= yes if the compiler's tools (pcc, plink etc.) don't 
  86. # understand Unix-like path names.
  87. # Comment this out if your compiler _does_ understand names like "/dev/c/foo".
  88.  
  89. TOSIFY_NAMES=    yes
  90.  
  91. # TOSIFY_COMMANDS= yes if your shell (see SHELL below) wants path names
  92. # in TOS form (i.e. does not understand unix compatible file names like
  93. # "/dev/c/foo"). Mupfel wants this.
  94. # Comment this out if your shell groks names like "/dev/c/foo".
  95. # NOTE: your versions of rm, cp, etc. _should_ understand
  96. #       unix-like names
  97.  
  98. #TOSIFY_COMMANDS=    yes
  99.  
  100. # sh_backslash= the string that should be passed to the shell as a single
  101. # backslash character. This depends on your shell (whether your
  102. # shell needs backslashes escaped with another backslash, as do most
  103. # unix-like shells). On contrast, Mupfel wants only one backslash, as well
  104. # as the shell that comes with `elvis'.
  105.  
  106. sh_backslash=    \\
  107. #sh_backslash=    \$(nothing)
  108.  
  109. # SHELL, RM, CP, INSTALL_DATA, AWK, ECHO: edit to suite your taste
  110. # These programs _should_ understand unix-like path names (like "/dev/c/foo").
  111. # INSTALL_DATA is only needed during "make install" and "make install-includes".
  112. # AWK is only needed when using Turbo C without the osbind library (see
  113. # explanation on OSBINDLIB above)
  114. # ECHO is only needed with Turbo C.
  115. #
  116. # all of these programs should understand the ARGV scheme.
  117.  
  118. SHELL=        /bin/sh            # a bourne shell
  119. #SHELL=        /usr/local/bin/bash    # GNU bash
  120. #SHELL=        c:/usr/gemini/1.89/mupfel.ttp # Mupfel 1.89 (don't try 1.21)
  121. #SHELL=        c:/bin/shell.ttp    # simple shell (from `elvis' distribution)
  122. #SHELL=                    # no shell at all (works only with Pure C)
  123.  
  124. RM=        rm
  125. CP=        cp
  126. AWK=        awk
  127. ECHO=        echo
  128. INSTALL_DATA=    cp
  129. #INSTALL_DATA=    install -m 644
  130.  
  131. ###
  132. ### end of configuration section
  133. ###
  134.  
  135. ### the compiler programs, and what flags they need
  136.  
  137. ifdef TOSIFY_NAMES
  138.   DIRSEP=    $(sh_backslash)
  139. else
  140.   DIRSEP=    /
  141. endif
  142.  
  143. ifdef TURBOC
  144.   CC :=        $(BINDIR)/tcc.ttp -W
  145.   AS :=        $(BINDIR)/mas.ttp
  146.   LD :=        $(BINDIR)/tlink.ttp
  147. else
  148.   CC :=        $(BINDIR)/pcc.ttp -W
  149.   AS :=        $(BINDIR)/pasm.ttp
  150.   LD :=        $(BINDIR)/plink.ttp
  151. endif
  152.  
  153. ifdef TOSIFY_COMMANDS
  154.   tosify_name := $(CC)
  155.   include tosify.mak
  156.   CC := $(tosify_name)
  157.  
  158.   tosify_name := $(AS)
  159.   include tosify.mak
  160.   AS := $(tosify_name)
  161.  
  162.   tosify_name := $(LD)
  163.   include tosify.mak
  164.   LD := $(tosify_name)
  165. endif
  166.  
  167. ifdef DEBUGINFO
  168.   CCSYMFLAGS=    -Y
  169.   ifdef TURBOC
  170.     ASSYMFLAGS=
  171.   else
  172.     ASSYMFLAGS=    -Y
  173.   endif
  174.   LDSYMFLAGS=    -G -L -Y
  175. else
  176.   CCSYMFLAGS=
  177.   ASSYMFLAGS=
  178.   LDSYMFLAGS=    -G
  179. endif
  180.  
  181. ifdef PCREL
  182.   CCRELFLAGS=
  183. else
  184.   CCRELFLAGS=    -P
  185. endif
  186.  
  187. MAKEOBJ=    -J
  188.  
  189. ifdef ASSERTIONS
  190.   CCDEBUGDEFS=
  191. else
  192.   CCDEBUGDEFS=    -DNDEBUG
  193. endif
  194.  
  195. INCSPEC :=    $(INCLUDEDIR)
  196.  
  197. # tosify the include specification
  198. ifdef TOSIFY_NAMES
  199.   tosify_name := $(INCSPEC)
  200.   include tosify.mak
  201.   INCSPEC := $(tosify_name)
  202. endif
  203.  
  204. CCINCFLAGS=    -I$(INCSPEC)
  205.  
  206. # with Turbo C, we need to work around its missing ARGV capability
  207. ifdef TURBOC
  208.   ARGV_WORKAROUND=    yes
  209. else
  210.   ARGV_WORKAROUND=
  211. endif
  212.  
  213. ### default flags to compiler, linker, assembler
  214.  
  215. CCFLAGS=    $(CCINCFLAGS) $(CCSYMFLAGS) $(CCRELFLAGS) $(CCDEBUGDEFS)
  216. ASFLAGS=    $(ASSYMFLAGS)
  217. LDFLAGS=    $(LDSYMFLAGS)
  218.  
  219. ### what to build
  220.  
  221. MINTLIB=    mintlib.lib
  222. MATHLIB=    mintflt.lib
  223. FPUMATHLIB=    mint881.lib
  224. STARTUPOBJ=    crt0.o
  225. ALLOCAOBJ=    alloca.o
  226. FPUALLOCAOBJ=    falloca.o
  227.  
  228. MYTOSLIB=    myosbind.lib
  229.  
  230. DIST_MATHLIB=    d_flt.lib
  231. DIST_FPUMATHLIB=    d_881.lib
  232.  
  233. ifdef TURBOC
  234.   ALL=        $(MINTLIB) $(MATHLIB) $(STARTUPOBJ) $(ALLOCAOBJ)
  235.   BINDIST=    $(MINTLIB) $(DIST_MATHLIB) $(STARTUPOBJ) $(ALLOCAOBJ)
  236. else
  237.   ALL=        $(MINTLIB) $(MATHLIB) $(STARTUPOBJ) $(ALLOCAOBJ) \
  238.     $(FPUMATHLIB) $(FPUALLOCAOBJ)
  239.   BINDIST=    $(MINTLIB) $(DIST_MATHLIB) $(STARTUPOBJ) $(ALLOCAOBJ) \
  240.     $(DIST_FPUMATHLIB) $(FPUALLOCAOBJ)
  241. endif
  242.  
  243. .PHONY:        all
  244. all:        $(ALL)
  245.  
  246. .PHONY:        bindist
  247. bindist:    $(BINDIST)
  248.  
  249. ### things we link from the compiler's distribution
  250.  
  251. ifdef TURBOC
  252.   CCFLOATLIB :=    $(LIBDIR)/tcfltlib.lib
  253. else
  254.   CCFLOATLIB :=    $(LIBDIR)/pcfltlib.lib
  255.   CC881LIB :=    $(LIBDIR)/pc881lib.lib
  256. endif
  257.  
  258. CCFLOATLIBSPEC :=    $(CCFLOATLIB)
  259. CC881LIBSPEC :=    $(CC881LIB)
  260.  
  261. # tosify the library specifications, if nessecary
  262. ifdef TOSIFY_NAMES
  263.   tosify_name := $(CCFLOATLIBSPEC)
  264.   include tosify.mak
  265.   CCFLOATLIBSPEC := $(tosify_name)
  266.  
  267.   tosify_name := $(CC881LIBSPEC)
  268.   include tosify.mak
  269.   CC881LIBSPEC := $(tosify_name)
  270. endif
  271.  
  272. ### which OS bindings library to link
  273.  
  274. BUILD_MYTOSLIB_DEP :=
  275.  
  276. # the osbind library replaces our tos library.
  277. ifdef OSBINDLIB
  278.   TOSLIB :=    $(OSBINDLIB)
  279. else
  280.   ifdef TURBOC
  281.     TOSLIB :=    $(MYTOSLIB)
  282.  
  283.     # used as a file dependency for $(MINTLIB)
  284.     BUILD_MYTOSLIB_DEP :=    $(MYTOSLIB)
  285.   else
  286.     TOSLIB :=
  287.   endif
  288. endif
  289.  
  290. TOSLIBSPEC :=    $(TOSLIB)
  291.  
  292. # tosify the library specification, if nessecary
  293. ifdef TOSIFY_NAMES
  294.   tosify_name := $(TOSLIBSPEC)
  295.   include tosify.mak
  296.   TOSLIBSPEC := $(tosify_name)
  297. endif
  298.  
  299. ### how to build MINTLIB
  300.  
  301. COMMONSRC :=    a64l.c abort.c abs.c access.c alarm.c alphasor.c atexit.c \
  302.   atol.c bblink.c bcmp.c binmode.c bsearch.c calloc.c cfspeed.c chdir.c \
  303.   chmod.c clock.c close.c console.c crtinit.c ctermid.c \
  304.   ctime.c ctype.c defmode.c dirent.c \
  305.   doprnt.c dup.c eprintf.c exec.c execp.c fclose.c fcntl.c fdopen.c fflush.c \
  306.   fgetc.c fgets.c filbuf.c findfile.c fopen.c fopenp.c fork.c fprintf.c \
  307.   fputc.c fputs.c fread.c frwbin.c fscanf.c fseek.c fsetpos.c ftw.c \
  308.   fungetc.c fwrite.c getbuf.c getcwd.c getdtabl.c getenv.c getgroup.c \
  309.   gethostn.c getlogin.c getopt.c getpages.c getpass.c getpid.c getpw.c \
  310.   getrusag.c gets.c getuid.c getw.c grp.c heapbase.c ic.c ident.c ig.c \
  311.   il.c inistack.c initsig.c ioctl.c ip.c isatty.c iw.c kill.c killpg.c \
  312.   link.c localtim.c lockf.c lseek.c ltoa.c main.c malloc.c memccpy.c \
  313.   memchr.c memcmp.c mkdir.c mkfifo.c mknod.c mktemp.c nice.c nlist.c \
  314.   obstack.c open.c \
  315.   pause.c perror.c pipe.c pgrp.c popen.c printf.c psignal.c putenv.c \
  316.   qsort.c raise.c \
  317.   rand.c random.c read.c realloc.c regexp.c regsup.c rename.c rmdir.c \
  318.   sbrk.c scandir.c scanf.c select.c setbuf.c setlocal.c setrlimi.c \
  319.   setvbuf.c sgtty.c sigactio.c sigblock.c siglist.c signal.c sleep.c \
  320.   spawn.c spawnve.c spawnvp.c sprintf.c sscanf.c stat.c statfs.c stksiz.c \
  321.   strcat.c strchr.c strcmp.c strcoll.c strcpy.c strcspn.c strdup.c \
  322.   strerror.c strftime.c stricmp.c strlen.c strlwr.c strncat.c strncmp.c \
  323.   strncpy.c strnicmp.c strpbrk.c strrchr.c strrev.c strspn.c strstr.c \
  324.   strtok.c strtol.c strtoul.c strupr.c symlink.c sysconf.c system.c \
  325.   sysvar.c tcattr.c tcbreak.c tcdrain.c tcflow.c tcflush.c tcpgrp.c \
  326.   textio.c thread.c time.c timeoday.c times.c tmpfile.c tmpnam.c \
  327.   toxxx.c truncate.c ttyname.c uname.c unlink.c unx2dos.c utime.c \
  328.   utmp.c vfprintf.c vprintf.c wait.c \
  329.   wait3.c waitpid.c wcmb.c \
  330.   wcscat.c wcscmp.c wcscpy.c wcslen.c wnull.c write.c wtmp.c 
  331. COMMONSRC := $(addprefix $(COMMONDIR)/,$(COMMONSRC))
  332.  
  333. SRC :=        bzero.c memset.c alloca2.c \
  334.   bcopy.s linea.s setjmp.s vfork.s
  335.  
  336. ifndef TOSLIB
  337.   # no tos bindings library -- link our bindings.
  338.   SRC :=    $(SRC) osbind.s bios.s xbios.s gemdos.s mintbind.s
  339.   bios.o xbios.o gemdos.o mintbind.o:    osmacros.s
  340. endif
  341.  
  342. ifdef TURBOC
  343.   SUPPORTSRC=    fpuinit.c stkover.s
  344. else
  345.   SUPPORTSRC=    fpuinit.c stkover.s pclong.s 
  346. endif
  347.  
  348. MINTSRC=    $(COMMONSRC) $(SUPPORTSRC) $(SRC)
  349.  
  350. MINTOBJ :=    $(patsubst %.c,%.o,$(MINTSRC))
  351. MINTOBJ :=    $(patsubst %.s,%.o,$(MINTOBJ))
  352.  
  353. ifdef ARGV_WORKAROUND
  354.   MINTLIB_CMD=    $(basename $(MINTLIB)).cmd
  355.   MINTLIB_PARAM=    -C=$(MINTLIB_CMD)
  356.   MINTLIB_DEP=    $(MINTOBJ) $(MINTLIB_CMD)
  357.  
  358.   $(MINTLIB_CMD):
  359.     -$(RM) -f $@
  360.     $(ECHO) -n $(subst /,$(DIRSEP),$(MINTOBJ)) > $@
  361. else
  362.   MINTLIB_PARAM=    $(subst /,$(DIRSEP),$(MINTOBJ))
  363.   MINTLIB_DEP=    $(MINTOBJ)
  364. endif
  365.  
  366. ifneq (,$(wildcard $(firstword $(MINTSRC))))
  367.   $(MINTLIB):    $(MINTLIB_DEP) $(BUILD_MYTOSLIB_DEP)
  368.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ $(MINTLIB_PARAM) $(TOSLIBSPEC)
  369. else
  370. # if the source is not present (binary distribution), we just check for
  371. # the presence of the library.
  372.   $(MINTLIB): ;
  373. endif
  374.  
  375. %.o:        %.s
  376.     $(AS) $(ASFLAGS) -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  377.  
  378. %.o:        %.c
  379.     $(CC) $(CCFLAGS) -D__NO_FLOAT__ \
  380.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  381.  
  382. $(COMMONDIR)/crtinit.o:    $(COMMONDIR)/crtinit.c
  383.     $(CC) -P -S- -T- $(CCFLAGS) -D__NO_FLOAT__ \
  384.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  385.  
  386. $(COMMONDIR)/main.o:    $(COMMONDIR)/main.c
  387.     $(CC) -P $(CCFLAGS) -D__NO_FLOAT__ \
  388.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  389.  
  390. $(COMMONDIR)/qsort.o:    $(COMMONDIR)/qsort.c
  391.     $(CC) -S -T $(CCFLAGS) -D__NO_FLOAT__ \
  392.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  393.  
  394. $(COMMONDIR)/thread.o:    $(COMMONDIR)/thread.c
  395.     $(CC) -P -S- $(CCFLAGS) -D__NO_FLOAT__ \
  396.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  397.  
  398. setjmp.o:    setjmp.s
  399.     $(AS) $(ASFLAGS) -D=FPU=0 \
  400.       -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  401.  
  402. ### how to build MYTOSLIB, our own tos bindings library
  403.  
  404. ifdef TURBOC
  405.   # for Turbo C, this is quite tricky.  Turbo's assembler MAS doesn't
  406.   # understand the directives ".MODULE" and ".ENDMOD", but we still want
  407.   # one module per binding.  That's why we use awk to cut modules
  408.   # from the source files and build one object file per binding.
  409.  
  410.   MYBINDSRC :=    bios.s xbios.s gemdos.s mintbind.s
  411.   
  412.   # we make a list of object file we want to build and re-instantiate `make'.
  413.   # in the new instance, we include that list into our makefile
  414.   MAKEINCL :=    myosbind.mak
  415.  
  416.   ifndef MAKEINCL_OK
  417.     $(MAKEINCL):    $(MYBINDSRC)
  418.     $(AWK) 'BEGIN { FS = " |:|\t" ; printf "MYBINDOBJ := " } /^\.MODULE/ { printf "%s.o ", $$2 }' \
  419.       $^ > $@
  420.  
  421.     $(MYTOSLIB):    $(MYBINDSRC) osmacros.s osbind.s $(MAKEINCL)
  422.     $(MAKE) $(MYTOSLIB) MAKEINCL_OK=yes
  423.   else
  424.  
  425.     # this should define MYBINDOBJ
  426.     include $(MAKEINCL)
  427.  
  428.     $(MYBINDOBJ):    %.o:    $(MYBINDSRC) osmacros.s
  429.     -$(RM) -f temp.s
  430.     $(AWK) -v name=$(patsubst %.o,%,$@) -f filter.awk $(MYBINDSRC) > temp.s
  431.     $(AS) $(ASFLAGS) -O=$@ temp.s
  432.  
  433.     ifdef ARGV_WORKAROUND
  434.       MYTOSLIB_CMD=    $(basename $(MYTOSLIB)).cmd
  435.       MYTOSLIB_PARAM=    -C=$(MYTOSLIB_CMD)
  436.       MYTOSLIB_DEP=    $(MYBINDOBJ) $(MYTOSLIB_CMD)
  437.     
  438.       $(MYTOSLIB_CMD):    $(MAKEINCL)
  439.     -$(RM) -f $@
  440.     $(ECHO) -n $(MYBINDOBJ) > $@
  441.     else
  442.       MYTOSLIB_PARAM=    $(MYBINDOBJ)
  443.       MYTOSLIB_DEP=    $(MYBINDOBJ)
  444.     endif
  445.  
  446.     $(MYTOSLIB):    osbind.o $(MYTOSLIB_DEP)
  447.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ osbind.o $(MYTOSLIB_PARAM)
  448.  
  449.   endif
  450. else
  451.   # with Pure C, everything's so much easier :-)
  452.   # however, it's unlikely that you'll need this.
  453.  
  454.   MYTOSSRC :=    osbind.s bios.s xbios.s gemdos.s mintbind.s
  455.   MYTOSOBJ :=    $(patsubst %.s,%.o,$(MYTOSSRC))
  456.  
  457.   bios.o xbios.o gemdos.o mintbind.o:    osmacros.s
  458.  
  459.   $(MYTOSLIB):    $(MYTOSOBJ)
  460.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ $^
  461.  
  462. endif
  463.  
  464. ### how to build MATHLIB
  465.  
  466. MATHOBJ=    m_main.o m_doprnt.o m_scanf.o m_difftime.o
  467.  
  468. ifneq ($(DIST_MATHLIB),$(wildcard $(DIST_MATHLIB)))
  469.   $(MATHLIB):    $(MATHOBJ) # $(CCFLOATLIB)
  470.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  471.       $(subst /,$(DIRSEP),$(MATHOBJ)) $(CCFLOATLIBSPEC)
  472. else
  473. # link with the bindist's rudimentary math library, if it exists
  474.   $(MATHLIB):    $(DIST_MATHLIB) # $(CCFLOATLIB)
  475.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  476.       $(DIST_MATHLIB) $(CCFLOATLIBSPEC)
  477. endif
  478.  
  479. ifneq (,$(wildcard $(patsubst m_%.o,$(COMMONDIR)/%.c,$(firstword $(MATHOBJ)))))
  480.   $(DIST_MATHLIB):    $(MATHOBJ)
  481.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  482.       $(subst /,$(DIRSEP),$(MATHOBJ))
  483. else
  484. # if the source is not present (binary distribution), we just check for
  485. # the presence of the distributable library.
  486.   $(DIST_MATHLIB): ;
  487. endif
  488.  
  489. m_%.o:        $(COMMONDIR)/%.c
  490.     $(CC) -T- $(CCFLAGS) \
  491.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  492.  
  493. m_main.o:    $(COMMONDIR)/main.c
  494.     $(CC) -T- -P $(CCFLAGS) \
  495.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  496.  
  497. ### how to build FPUMATHLIB
  498.  
  499. FPUMATHOBJ =    f_main.o f_doprnt.o f_scanf.o f_difftime.o f_setjmp.o
  500.  
  501. ifneq ($(DIST_FPUMATHLIB),$(wildcard $(DIST_FPUMATHLIB)))
  502.   $(FPUMATHLIB):    $(FPUMATHOBJ) # $(CC881LIB)
  503.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  504.       $(subst /,$(DIRSEP),$(FPUMATHOBJ)) $(CC881LIBSPEC)
  505. else
  506. # link with the bindist's rudimentary math library, if it exists
  507.   $(FPUMATHLIB):    $(DIST_FPUMATHLIB) # $(CC881LIB)
  508.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  509.       $(DIST_FPUMATHLIB) $(CC881LIBSPEC)
  510. endif
  511.  
  512. ifneq (,$(wildcard $(patsubst f_%.o,$(COMMONDIR)/%.c,$(firstword $(FPUMATHOBJ)))))
  513.   $(DIST_FPUMATHLIB):    $(FPUMATHOBJ)
  514.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  515.       $(subst /,$(DIRSEP),$(FPUMATHOBJ))
  516. else
  517. # if the source is not present (binary distribution), we just check for
  518. # the presence of the distributable library.
  519.   $(DIST_FPUMATHLIB): ;
  520. endif
  521.  
  522. f_%.o:        $(COMMONDIR)/%.c
  523.     $(CC) -T- -8 $(CCFLAGS) \
  524.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  525.  
  526. f_main.o:    $(COMMONDIR)/main.c
  527.     $(CC) -T- -8 -P $(CCFLAGS) \
  528.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  529.  
  530. f_setjmp.o:    setjmp.s
  531.     $(AS) $(ASFLAGS) -D=FPU=1 \
  532.       -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  533.  
  534. ### how to build the startup code
  535.  
  536. STARTUPSRC=    crt0.s
  537.  
  538. ifneq (,$(wildcard $(STARTUPSRC)))
  539.   $(STARTUPOBJ):    $(STARTUPSRC)
  540.     $(AS) $(ASFLAGS) -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  541. else
  542. # if the source is not present (binary distribution), we just check for
  543. # the presence of the object files.
  544.   $(STARTUPOBJ): ;
  545. endif
  546.  
  547. ### how to build the fast versions of alloca()
  548.  
  549. ALLOCASRC=    alloca.s
  550.  
  551. ifneq (,$(wildcard $(ALLOCASRC)))
  552.   $(ALLOCAOBJ):    $(ALLOCASRC)
  553.     $(AS) $(ASFLAGS) -D=STACKCH=1 -D=FPU=0 \
  554.       -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  555.  
  556.   $(FPUALLOCAOBJ):    $(ALLOCASRC)
  557.     $(AS) $(ASFLAGS) -D=STACKCH=1 -D=FPU=1 \
  558.       -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  559. else
  560. # if the source is not present (binary distribution), we just check for
  561. # the presence of the object files.
  562.   $(ALLOCAOBJ): ;
  563.   $(FPUALLOCAOBJ): ;
  564. endif
  565.  
  566. ### how to build the test program
  567.  
  568. .PHONY:        test
  569. test:        test.tos
  570.  
  571. ifdef TURBOC
  572.   CCSTDLIB :=    $(LIBDIR)/tcstdlib.lib
  573.   CCSTDLIBSPEC :=    $(CCSTDLIB)
  574.   ifdef TOSIFY_NAMES
  575.     tosify_name :=    $(CCSTDLIBSPEC)
  576.     include tosify.mak
  577.     CCSTDLIBSPEC :=    $(tosify_name)
  578.   endif
  579.  
  580.   TEST_LINKLIBS=    $(CCSTDLIBSPEC)
  581. else
  582.   TEST_LINKLIBS=
  583. endif
  584.  
  585. test.tos:    $(MINTLIB) $(STARTUPOBJ) test.o
  586.     $(LD) $(LDFLAGS) -S=0 -O=$@ $(STARTUPOBJ) test.o \
  587.       $(MINTLIB) $(TEST_LINKLIBS)
  588.  
  589. test.o:        test.c
  590.     $(CC) -S $(CCFLAGS) -O$@ $<
  591.     
  592. ### how to make clean
  593.  
  594. .PHONY:        clean
  595. clean:
  596.     -$(RM) -f $(COMMONDIR)/*.o
  597.     -$(RM) -f *.o
  598.     -$(RM) -f *.cmd
  599.     -$(RM) -f temp.s test.tos
  600.  
  601. .PHONY:        realclean
  602. realclean:    clean
  603.     -$(RM) -f *.lib
  604. ifdef MAKEINCL
  605.     -$(RM) -f $(MAKEINCL)
  606. endif
  607.  
  608. ### how to install
  609.  
  610. .PHOHY:        install
  611. install:    $(ALL)
  612.     $(INSTALL_DATA) $(ALL) $(INSTALLDIR)
  613.  
  614. .PHONY:        install-includes
  615. install-includes:
  616.     $(INSTALL_DATA) $(COMPILERINCDIR)/float.h $(INCLUDEDIR)/tcfloat.h
  617.     $(INSTALL_DATA) $(COMPILERINCDIR)/math.h $(INCLUDEDIR)/tcmath.h
  618.